package com.codecrane.core.mybatis;

import lombok.Getter;

/**
 * Created by 752322896 on 2019/4/6.
 */
@Getter
public enum DataSourceType {
    MYSQL("MYSQL","默认数据源"),
    ORACLE("ORACLE","ERP数据源"),
    SQLSERVER("SQLSERVER","OA数据源"),
    PHYON("PHYON","PHYON数据源");

    DataSourceType(String source,String desc){
        this.source=source;
        this.desc=desc;
    }
    String source;
    String desc;

    public static String getByKey(String hashKey){
        //根据hashkey来获取所需要的数据源
        int i = Math.abs(hashKey.hashCode()) % DataSourceType.values().length;
        return DataSourceType.values()[i].getSource();
    }
}
